home *** CD-ROM | disk | FTP | other *** search
/ PC Format (UK) 188 / 01-04 PC Format 188 [2006-06] DVD side 1_.iso / DiscContents / Workshops / Workshops_Games / Gamer's Internet Tunnel / Git-099b4.exe / {app} / Generic TCP or UDP.git < prev    next >
Text File  |  2004-12-17  |  4KB  |  119 lines

  1. # GIT Wizard script Generic TCP or UDP game
  2.  
  3. # Base common settings
  4. setvar sockets ""
  5. setvar ports "1-212 : All below GIT range"
  6. addline ports "241-65535 : All the rest"
  7. setvar options OPT_FRAME_ETH2
  8. addflag options OPT_IPV4_SRCP
  9. addflag options OPT_IPV4_NORT
  10. addflag options OPT_OTHER_ARP
  11. addflag options OPT_COMP_ZLIB
  12. setvar packets 0
  13. setvar protos PROTO_TCP
  14. addflag protos PROTO_UDP
  15. addflag protos PROTO_ICMP
  16.  
  17. setvar heading "Important Information"
  18. setvar subheading "LAN configuration"
  19. addline control "label||In order to work most generically, every LAN must be on the subnet and use the same subnet mask."
  20. appendstring control "  No computers or routers can share an IP address, and one computer on each LAN must run GIT and be able to map ports to it."
  21. appendstring control "  For example, if your LAN uses 192.168.0.1 for its router and your computers are 192.168.0.2 and 192.168.0.3, the other LAN must not use 192.168.0.1 through 192.168.0.3 at all."
  22. appendstring control "  The other LAN must be on the same 192.168.0.x subnet though, so the IP address of the router must be changed to something like 192.168.0.11 and the computers on that LAN can be numbered with 192.168.0.12 and 192.168.0.13."
  23. appendstring control "  Beyond configuring each LAN as stated above, the only other thing you will need is the external IP address of each LAN."
  24. appendstring control "|15"
  25. showpage
  26.  
  27. # Page Asking for IP + Ask for a list of all others
  28. loadvar externalhostname
  29. loadvar servhostlist
  30. removeblanklines servhostlist
  31. sortlines servhostlist
  32. setvar heading "Host/IP List"
  33. setvar subheading "Information to provide to other LANs."
  34. addline control "label||What is your external hostname or IP address?"
  35. addline control "text1|externalhostname||4"
  36. addline control "label||You must provide this information to the person running GIT on each LAN now."
  37. addline control "space|||2"
  38. addline control "textm|servhostlist|Enter the hostname or IP each other person provides, one per line, including your own:|8"
  39. addline control "label||Everybody running GIT must have the all of the same hostnames or IPs listed here."
  40. showpage
  41. savevar externalhostname
  42. removeblanklines servhostlist
  43. sortlines servhostlist
  44. savevar servhostlist
  45.  
  46. setvar myhost externalhostname
  47.  
  48. # Must have at least two listed
  49. numlines numhosts servhostlist 
  50. if numhosts < 2
  51.     cancel "You must list at least your own host and one other."
  52. endif
  53.  
  54. # Figure out where in the list of hosts is ourself
  55. setvar myhostnum -1
  56. setvar i 0
  57. while i < numhosts
  58.     getline host servhostlist i
  59.     if host = myhost
  60.         setvar myhostnum i
  61.     endif
  62.     math i i + 1
  63. endwhile
  64.  
  65. # Make sure they listed themselves
  66. if myhostnum < 0
  67.     cancel "Your own hostname or IP was not found in the list."
  68. endif
  69.  
  70. # Loop through all the hosts and assign a port to each combination
  71. # Save all the ports/connections that involve ourself
  72. setvar port 213
  73. setvar hosts ""
  74. setvar portlist ""
  75. setvar i 0
  76. while i < numhosts
  77.     setvar j i
  78.     math j j + 1
  79.     while j < numhosts
  80.         setvar host ""
  81.         if i = myhostnum
  82.             getline host servhostlist j
  83.         endif
  84.         if j = myhostnum
  85.             getline host servhostlist i
  86.         endif
  87.         if host != ""
  88.             appendstring host ":"
  89.             appendstring host port
  90.             appendstring host METH_UDP
  91.             addline hosts host
  92.             addline portlist port
  93.         endif
  94.         math j j + 1
  95.         math port port + 1
  96.     endwhile
  97.     math i i + 1
  98. endwhile
  99.  
  100. # Show a reminder page listing ports to map
  101. setvar heading "Reminder"
  102. setvar subheading "Ports to map"
  103. # Create a nice string out of the list of ports
  104. removeblanklines portlist
  105. numlines i portlist
  106. if i > 1
  107.     math i i - 1
  108.     getline port portlist i
  109.     prependstring port "and "
  110.     setline portlist i port
  111. endif
  112. joinlines portlist ", "
  113. addline control "label||Reminder: You must map port "
  114. appendstring control portlist
  115. appendstring control " from "
  116. appendstring control externalhostname
  117. appendstring control " to the computer running GIT.|2"
  118. showpage
  119.